package com.jetinno.utils;

import android.os.Environment;

import java.io.File;

/**
 * Description : 专门管理文件路径的类
 * Author :mhwang
 * Date : 2017/11/23
 * Version : V1.0
 */
public final class FilePath {
    public static final String ROOT_NAME = "Jetinno";
    public static final File EXTERNAL_STORAGE_FILE = Environment.getExternalStorageDirectory();
    //文件根路径
    public static final String ROOT_PATH = Environment.getExternalStorageDirectory() + File.separator + ROOT_NAME;

    public static final String[] IMG_SUFFIXS = new String[]{".gif", ".png", ".jpg"};
    public static final String[] IMG_SUFFIXS2 = new String[]{".png", ".jpg", ".jpeg"};

    public static final String canister_config_name = "canister_config.json";
    public static final String translate_config_name = "translate_config.json";
    public static final String global_config_name = "global_config.json";

    /**
     * 导出消息的分割线
     */
    public final static String RECIPE_SUFFIX = ".recipe";
    public final static String JSON_SUFFIX = ".json";
    public final static String PRODUCT_SUFFIX = ".product";

    public static final class Suffix {
        public static final String PNG = ".png";
        public static final String JPG = ".jpg";
        public static final String JPEG = ".jpeg";
        public static final String GIF = ".gif";
        public static final String MP4 = ".mp4";
        public static final String MKV = ".mkv";
        public static final String AVI = ".avi";
        public static final String RMVB = ".rmvb";
    }

    public static boolean isImage(String fileName) {
        return fileName.endsWith(Suffix.PNG) || fileName.endsWith(Suffix.JPG) || fileName.endsWith(Suffix.JPEG);
    }

    public static boolean isGif(String fileName) {
        return fileName.endsWith(Suffix.GIF);
    }

    public static final class Jetinno {
        //ini配置文件
        //配置文件存储路径
        public static final String Config = ROOT_PATH + File.separator + "Config";
        //日志文件夹
        public static final String CustomPictures = ROOT_PATH + File.separator + "CustomPictures";
        //售卖模块等web数据
        public static final String Html = ROOT_PATH + File.separator + "Html";
        //订单日志等
        public static final String Log = ROOT_PATH + File.separator + "Log";
        //饮品浓度信息
        public static final String NutritionInfo = ROOT_PATH + File.separator + "NutritionInfo";
        //饮品图片
        public static final String ProductImage = ROOT_PATH + File.separator + "ProductImage";
        //饮品大图
        public static final String ProductImageBig = ROOT_PATH + File.separator + "ProductImageBig";
        //饮品完成图
        public static final String ProductImageFinish = ROOT_PATH + File.separator + "ProductImageFinish";
        //屏保图
        public static final String ScreenProtect = ROOT_PATH + File.separator + "ScreenProtect";
        //下载资源
        public static final String Download = ROOT_PATH + File.separator + "Download";
        //支付图片
        public static final String RadioButtonImage = ROOT_PATH + File.separator + "RadioButtonImage";
        //资源图片
        public static final String Drawable = ROOT_PATH + File.separator + "Drawable";
        //订单
        public static final String Order = ROOT_PATH + File.separator + "Order";

        //微信刷脸支付商户信息参数配置文件
        public static final String bussiness_params = ROOT_PATH + File.separator + "bussiness_params.wxfp";
        public static final String JetinnoSystemApk = ROOT_PATH + File.separator + "jetinnosystem.apk";
        //文件和字段释义
        public static final String document = ROOT_PATH + File.separator + "document.json";
    }

    public static final class Config {
        //配置文件machine_config.ini所在路径
        public static final String machine_config = Jetinno.Config + File.separator + "machine_config.json";
        //配置文件global_config.ini所在路径
        public static final String global_config = Jetinno.Config + File.separator + "global_config.json";
        //配置文件pay_config.ini所在路径
        public static final String pay_config = Jetinno.Config + File.separator + "pay_config.json";
        //配置文件canister_config.ini所在路径
        public static final String canister_config = Jetinno.Config + File.separator + canister_config_name;
        //        //故障文件
        public static final String fault_config = Jetinno.Config + File.separator + "fault_config.json";
        //        //翻译文件
        public static final String translate_config = Jetinno.Config + File.separator + translate_config_name;
    }

    public static final class Custom {
        public static final String ic_public_sign = Jetinno.CustomPictures + File.separator + "ic_public_sign";  //客服二维码图片
        public static final String ic_loading = Jetinno.CustomPictures + File.separator + "ic_loading"; //首页启动图片,引导页面背景图片
        public static final String ic_home_background = Jetinno.CustomPictures + File.separator + "ic_home_background";  //首页背景图片
        public static final String ic_error = Jetinno.CustomPictures + File.separator + "ic_error";  //维护图片，补货页面
        public static final String gif_lack_recipe = Jetinno.CustomPictures + File.separator + "gif_lack_recipe";//维护图片
        public static final String ic_making_product = Jetinno.CustomPictures + File.separator + "ic_making_product";  //咖啡制作中
        public static final String ic_product_finish = Jetinno.CustomPictures + File.separator + "ic_product_finish";//咖啡制作结束
        public static final String ic_logo = Jetinno.CustomPictures + File.separator + "ic_logo.png";//menuic_logo
    }

    public static final class Html {
        public static final String Menu = Jetinno.Html + File.separator + "Menu";
    }

    public static final class Download {
        public static final String Apk = Jetinno.Download + File.separator + "Apk";
    }

    public static final class Log {
        public static final String Order = Jetinno.Log + File.separator + "Order" + File.separator + "order";
    }

    public static final class Drawable {
    }

    public static final String getDrawablePath(String drawableName) {
        return Jetinno.CustomPictures + File.separator + drawableName + Suffix.PNG;
    }

    public static final String getGifPath(String drawableName) {
        return Jetinno.CustomPictures + File.separator + drawableName + Suffix.GIF;
    }
}
